package com.zzyl.nursing.controller.member;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/member/orders/project")
@Slf4j

public class MemberOrderController extends BaseController {
    @Autowired
    private INursingProjectService nursingProjectService;
    @GetMapping("/page")
    public TableDataInfo<List<NursingProject>> page(String name,Integer status){
        startPage();
        List<NursingProject> list = nursingProjectService.list(Wrappers.<NursingProject>lambdaQuery()
                .like(name!=null,NursingProject::getName, name).eq(status!=null,NursingProject::getStatus, status));
        return getDataTable(list);

    }
    @GetMapping("/{id}")
    public R<NursingProject> getInfo(@PathVariable Long id){
        NursingProject byId = nursingProjectService.getById(id);
        return R.ok(byId);
    }
}
